﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcDemo.Models;

namespace MvcDemo.Controllers
{
    public class OverLayController : Controller
    {
        //
        // GET: /OverLay/

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult FormA()
        {
            return View();
        }

        public ActionResult FormB()
        {
            HttpRequestBase request = this.Request;
            return View();
        }

        [HttpPost]
        public ActionResult FormB(string m)
        {
            HttpRequestBase request = this.Request;
            bool isAjaxDeal = false;
            if (request.Params["isAjaxDeal"] != null)
            {
                isAjaxDeal = true;
            }

            if (isAjaxDeal == true)
            {
                return Content("you are ok.");
            }
            else
            {
                return new EmptyResult();//Json("sss:Success");
            }
        }

        public ActionResult TwoWay()
        {
            return View();
        }

        [HttpPost]
        public ActionResult TwoWay(Student s)
        {
            Student ss = s;
            HttpRequestBase request = this.Request;
            bool isAjaxDeal = false;
            if (request.Params["isAjaxDeal"] != null)
            {
                isAjaxDeal = true;
            }
            return View();
        }

        public ActionResult AjaxWay()
        {
            return PartialView();
        }

        [HttpPost]
        public ActionResult AjaxWay(Student s)
        {
            Student ss = s;
            HttpRequestBase request = this.Request;
            bool isAjaxDeal = false;
            if (request.Params["isAjaxDeal"] != null)
            {
                isAjaxDeal = true;
            }

            string userName = s.Name;

            if (isAjaxDeal == true)
            {
                return Content("you are ok.");
            }
            else
            {
                return View();//Json("sss:Success");
            }
        }

        public ActionResult Container()
        {
            return View();
        }

        public ActionResult Success()
        {
            return View();
        }

        public ActionResult FormBB()
        {

            return View("FormB");
        }

        [HttpPost]
        public ActionResult FormBB(string inputA)
        {
            string temp = inputA;
            HttpRequestBase request = this.Request;
            return PartialView("Success");
        }
    }
}
